import com.alibaba.fastjson.JSON;
import com.ljw.EsApplication;
import com.ljw.service.CompanyWxGroupSetApiServiceImpl;
import de.otto.flummi.response.SearchResponse;
import de.otto.flummi.response.SumAggregationResult;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * @Author: lijunwei
 * @Time: 2019/3/21 19:21
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {EsApplication.class})
public class Demo01 {
    @Autowired
    private CompanyWxGroupSetApiServiceImpl companyWxGroupSetApiServiceImpl;

    @Test
    public void  test01(){
        SearchResponse searchResponse = companyWxGroupSetApiServiceImpl.searchBrandMemberResponse(11L, null, null);

        SumAggregationResult consumeAmountBrandAllSumResult = (SumAggregationResult) searchResponse
                .getAggregations().get("consumeAmountBrandAllSum");
        System.out.println("---------------------"+ JSON.toJSONString(consumeAmountBrandAllSumResult));
    }

}
